#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
 
int main()
{
    int n = 0, k = 0;
    cin >> n >> k;
    vector<int> arr(n);
    priority_queue<int, vector<int>, greater<int>> heap;
    for(int i = 0; i < n; ++i)
    {
        cin >> arr[i];
        heap.push(arr[i]);
    }
    int sum = 0, res = 0;
    while(heap.size() && sum + heap.top() <= k)
    {
        int x = heap.top();
        heap.pop();
        sum += x;
        heap.push(x * 2);
        ++res;
    }
    cout << res << endl;
    return 0;
}